# -*- encoding:utf-8 -*-

import sys
import os
import base64
from django.conf import settings
#sys.modules['studio.utils.timezone']=sys.modules['datetime']
from studio import resource
from studio import Scanner
old_proxy=resource.proxy

def proxy_patch(request,path):
    path=base64.b64encode(os.path.join(settings.BASE_DIR,'static','monkey','566128c4Na6aeadab.jpg') )
    return old_proxy(request, path)

resource.proxy=proxy_patch



from api import ps

def get_app_meta(self,sku):
    return 'this is test meta infomation,this is test meta infomation,this is test meta infomation,this is test meta infomation'

ps.PS.get_app_meta=get_app_meta


from api import pts
def get_studios(self):
    """
    rt:  studio name list : [ name1,name2]
    """
    return ['studio1','studio2']

def get_apps(self,studio):
    """
    @studio:str: studio name (in pts is pub_name)
    
    rt:
        app list : [{}]
    """
    return [{'sku':'SKU1','app_code':'appcode1','media_url':r'df/gdf/dhdf','status':'normal'},
            {'sku':'SKUU22','app_code':'appcode22','media_url':r'df/gdf/dhdf','status':'abnormal'}]

pts.PTS.get_studios=get_studios
pts.PTS.get_apps=get_apps

class Object(object):
    pass

def get_appresource(app):
    rt=Object()
    rt.appIcon="sdgsgs"                  
    rt.featuredPic="sdgs"               
    rt.screenshots=['jjj','yyyy'] 
    return rt
Scanner.getAppRes= get_appresource